from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `chat_session` ALTER COLUMN `model` SET DEFAULT '';
        ALTER TABLE `chat_session` MODIFY COLUMN `user_id_id` INT;
        ALTER TABLE `chat_session` ALTER COLUMN `object` SET DEFAULT '';
        ALTER TABLE `chat_session` MODIFY COLUMN `owner_key_id` INT;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `chat_session` ALTER COLUMN `model` DROP DEFAULT;
        ALTER TABLE `chat_session` MODIFY COLUMN `user_id_id` INT NOT NULL;
        ALTER TABLE `chat_session` ALTER COLUMN `object` DROP DEFAULT;
        ALTER TABLE `chat_session` MODIFY COLUMN `owner_key_id` INT NOT NULL;"""
